﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Shop.Application.UserAdmin;
using Shop.Application.UserAdmin.Dto;

namespace Shop.UI.API
{
    [Route("API/[controller]")]
    public class UserController : Controller
    {
        private CreateUser _createUser;
        private DeleteUser _deleteUser;
        private GetUserByUserID _getUserByID;
        private GetUserByUserName _getUserByName;

        public UserController(CreateUser createUser,DeleteUser deleteUser,GetUserByUserID getUserByUserID,GetUserByUserName getUserByUserName)
        {
            _createUser = createUser;
            _deleteUser = deleteUser;
            _getUserByID = getUserByUserID;
            _getUserByName = getUserByUserName;
        }

        [HttpPost("CreateUser")]
        public IActionResult CreateUser([FromBody] UserInput input) => Ok(_createUser.Do(input));

        [HttpGet("GetUserByID")]
        public IActionResult GetUserByID(string id) => Ok(_getUserByID.Do(id));

        [HttpGet("GetUserByName")]
        public IActionResult GetUserByName(string name) => Ok(_getUserByName.Do(name));

        [HttpDelete("DeleteUser")]
        public IActionResult DeleteUser(string id) => Ok(_deleteUser.Do(id));


    }
}
